package com.zfdang.touchhelper.bean;

import android.graphics.Rect;

import java.io.Serializable;
import java.util.Objects;

/**
 * 需要点击的 控件
 *
 * @author ly-dengpw
 */
public class PackageWidgetInfoBean implements Serializable {
    public String packageName, activityName, className, idName, description, text;
    public Rect position;
    public boolean clickable, onlyClick;

    public PackageWidgetInfoBean() {
        this.packageName = "";
        this.activityName = "";
        this.className = "";
        this.idName = "";
        this.description = "";
        this.text = "";
        this.position = new Rect();
        this.clickable = false;
        this.onlyClick = false;
    }

    public PackageWidgetInfoBean(PackageWidgetInfoBean widgetDescription) {
        this.packageName = widgetDescription.packageName;
        this.activityName = widgetDescription.activityName;
        this.className = widgetDescription.className;
        this.idName = widgetDescription.idName;
        this.description = widgetDescription.description;
        this.text = widgetDescription.text;
        this.position = new Rect(widgetDescription.position);
        this.clickable = widgetDescription.clickable;
        this.onlyClick = widgetDescription.onlyClick;

    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof PackageWidgetInfoBean)) {
            return false;
        }
        PackageWidgetInfoBean widget = (PackageWidgetInfoBean) obj;
        return position.equals(widget.position);
    }

    @Override
    public int hashCode() {
        return Objects.hash(position);
    }
}
